package com.util;

import com.alibaba.fastjson.JSONObject;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class MyUtil {
    public static void jsonWriter(HttpServletResponse response,Object o){
        PrintWriter out = null;
        try {
            out = response.getWriter();
        } catch (IOException e) {
            e.printStackTrace();
        }
        out.println(JSONObject.toJSONString(o));
        out.close();
    }
    public static String getMethon(HttpServletRequest request){
        String url = request.getRequestURI();
        return url.substring(url.lastIndexOf("/") + 1);
    }
}
